home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / MaximaVolley / Maxima-Volley.jar / MaximaVolley.class (.txt) next >
Encoding:
Java Class File  |  2002-01-31  |  4.6 KB  |  190 lines

  1. import java.io.IOException;
  2. import javax.microedition.lcdui.Command;
  3. import javax.microedition.lcdui.CommandListener;
  4. import javax.microedition.lcdui.Display;
  5. import javax.microedition.lcdui.Displayable;
  6. import javax.microedition.lcdui.Form;
  7. import javax.microedition.lcdui.Image;
  8. import javax.microedition.lcdui.ImageItem;
  9. import javax.microedition.lcdui.StringItem;
  10. import javax.microedition.midlet.MIDlet;
  11.  
  12. public class MaximaVolley extends MIDlet implements CommandListener {
  13.    private static final int COLOR_WHITE = 16777215;
  14.    private static final int COLOR_BLACK = 0;
  15.    private int GAME_SPEED = 4;
  16.    private MaximaVolley$GameFrame mainFrame = new MaximaVolley$GameFrame(this);
  17.    private Form AboutScreen;
  18.    private Form ResultScreen;
  19.    private Form Splash = new Form("Maxima-Volley");
  20.    private Command Back = new Command("Back", 4, 2);
  21.    private Command About = new Command("About", 4, 2);
  22.    private Command Done = new Command("Done", 4, 1);
  23.    private Command Again = new Command("Again", 4, 2);
  24.    private Command Exit = new Command("Exit", 4, 1);
  25.    private long elapsedTime;
  26.    private long time;
  27.    public int rand;
  28.    // $FF: renamed from: p1 int
  29.    public int field_0;
  30.    // $FF: renamed from: p2 int
  31.    public int field_1;
  32.    // $FF: renamed from: pr int
  33.    public int field_2;
  34.    public int gol;
  35.    public int touch;
  36.    public int touch1;
  37.    private MaximaVolley$Ball myBall;
  38.    private MaximaVolley$Player myPlayer;
  39.    private MaximaVolley$Player myPlayer1;
  40.    private boolean gameOver = true;
  41.    private int numGames;
  42.    private Display myDisplay = Display.getDisplay(this);
  43.  
  44.    public MaximaVolley() {
  45.       try {
  46.          this.Splash.append(new ImageItem((String)null, Image.createImage("/Voll.png"), 3, (String)null));
  47.       } catch (IOException var2) {
  48.          this.Splash.append("An application by NotTheFly Component Solutions");
  49.       }
  50.  
  51.       this.Splash.addCommand(this.Done);
  52.       this.Splash.addCommand(this.About);
  53.       this.Splash.setCommandListener(this);
  54.       this.AboutScreen = new Form("Maxima-Volley");
  55.       this.AboutScreen.append(new StringItem((String)null, "The classic arcade game, now on your mobile device! Press 0 to exit!"));
  56.       this.AboutScreen.addCommand(this.Back);
  57.       this.AboutScreen.setCommandListener(this);
  58.       this.ResultScreen = new Form("Results");
  59.       this.ResultScreen.addCommand(this.Again);
  60.       this.ResultScreen.addCommand(this.Exit);
  61.       this.ResultScreen.setCommandListener(this);
  62.    }
  63.  
  64.    protected void startApp() {
  65.       this.myDisplay.setCurrent(this.Splash);
  66.    }
  67.  
  68.    protected void pauseApp() {
  69.       this.gameOver = true;
  70.       this.myBall = null;
  71.       this.myPlayer = null;
  72.       this.myPlayer1 = null;
  73.    }
  74.  
  75.    protected void destroyApp(boolean var1) {
  76.       this.gameOver = true;
  77.    }
  78.  
  79.    public void commandAction(Command var1, Displayable var2) {
  80.       if (var1 == this.About) {
  81.          Display.getDisplay(this).setCurrent(this.AboutScreen);
  82.       }
  83.  
  84.       if (var1 == this.Back) {
  85.          Display.getDisplay(this).setCurrent(this.Splash);
  86.       }
  87.  
  88.       if (var1 == this.Exit) {
  89.          this.destroyApp(false);
  90.          ((MIDlet)this).notifyDestroyed();
  91.       }
  92.  
  93.       if (var1 == this.Done || var1 == this.Again) {
  94.          Display.getDisplay(this).setCurrent(this.mainFrame);
  95.          this.field_0 = 0;
  96.          this.field_1 = 0;
  97.          this.field_2 = -1;
  98.          this.touch = this.touch1 = 0;
  99.          this.gameOver = false;
  100.          this.myBall = new MaximaVolley$Ball(this);
  101.          this.myPlayer = new MaximaVolley$Player(this);
  102.          this.myPlayer1 = new MaximaVolley$Player(this);
  103.          this.elapsedTime = System.currentTimeMillis();
  104.          this.time = this.elapsedTime;
  105.          this.myBall.setUp(1);
  106.          this.myPlayer.setUp(1);
  107.          this.myPlayer1.setUp(2);
  108.          this.myBall.start();
  109.          this.myPlayer.start();
  110.          this.myPlayer1.start();
  111.       }
  112.  
  113.    }
  114.  
  115.    // $FF: synthetic method
  116.    static MaximaVolley$Player access$000(MaximaVolley var0) {
  117.       return var0.myPlayer;
  118.    }
  119.  
  120.    // $FF: synthetic method
  121.    static MaximaVolley$GameFrame access$100(MaximaVolley var0) {
  122.       return var0.mainFrame;
  123.    }
  124.  
  125.    // $FF: synthetic method
  126.    static MaximaVolley$Player access$200(MaximaVolley var0) {
  127.       return var0.myPlayer1;
  128.    }
  129.  
  130.    // $FF: synthetic method
  131.    static MaximaVolley$Ball access$300(MaximaVolley var0) {
  132.       return var0.myBall;
  133.    }
  134.  
  135.    // $FF: synthetic method
  136.    static boolean access$400(MaximaVolley var0) {
  137.       return var0.gameOver;
  138.    }
  139.  
  140.    // $FF: synthetic method
  141.    static long access$502(MaximaVolley var0, long var1) {
  142.       return var0.time = var1;
  143.    }
  144.  
  145.    // $FF: synthetic method
  146.    static int access$602(MaximaVolley var0, int var1) {
  147.       return var0.GAME_SPEED = var1;
  148.    }
  149.  
  150.    // $FF: synthetic method
  151.    static boolean access$402(MaximaVolley var0, boolean var1) {
  152.       return var0.gameOver = var1;
  153.    }
  154.  
  155.    // $FF: synthetic method
  156.    static int access$708(MaximaVolley var0) {
  157.       return var0.numGames++;
  158.    }
  159.  
  160.    // $FF: synthetic method
  161.    static int access$700(MaximaVolley var0) {
  162.       return var0.numGames;
  163.    }
  164.  
  165.    // $FF: synthetic method
  166.    static Form access$800(MaximaVolley var0) {
  167.       return var0.ResultScreen;
  168.    }
  169.  
  170.    // $FF: synthetic method
  171.    static Display access$900(MaximaVolley var0) {
  172.       return var0.myDisplay;
  173.    }
  174.  
  175.    // $FF: synthetic method
  176.    static int access$600(MaximaVolley var0) {
  177.       return var0.GAME_SPEED;
  178.    }
  179.  
  180.    // $FF: synthetic method
  181.    static long access$500(MaximaVolley var0) {
  182.       return var0.time;
  183.    }
  184.  
  185.    // $FF: synthetic method
  186.    static int access$608(MaximaVolley var0) {
  187.       return var0.GAME_SPEED++;
  188.    }
  189. }
  190.